Page({
  data: {
    currentImageIndex: 0,
    buildingImages: [
      { url: 'https://via.placeholder.com/800x600?text=图片1', description: '楼宇正门' },
      { url: 'https://via.placeholder.com/800x600?text=图片2', description: '楼宇侧视图' },
      { url: 'https://via.placeholder.com/800x600?text=图片3', description: '内部大厅' },
      { url: 'https://via.placeholder.com/800x600?text=图片4', description: '会议室' }
    ],
    buildingInfo: {
      id: 1,
      name: 'A1栋',
      description: '这是一栋现代化厂房，配备先进的设施',
      area: 'A区',
      address: '北京市朝阳区某某路123号',
      totalArea: 5000,
      availableArea: 2000,
      rentedArea: 3000,
      floors: [
        { floorNumber: 1, totalArea: 1500, availableArea: 500, rentedArea: 1000 },
        { floorNumber: 2, totalArea: 1500, availableArea: 700, rentedArea: 800 },
        { floorNumber: 3, totalArea: 2000, availableArea: 800, rentedArea: 1200 }
      ],
      companies: [
        { id: 1, name: 'ABC科技有限公司', logo: 'https://via.placeholder.com/100x100?text=ABC', description: '专注于人工智能技术研发', joinTime: '2023-01-15', expireTime: '2024-01-14' },
        { id: 2, name: 'XYZ制造有限公司', logo: 'https://via.placeholder.com/100x100?text=XYZ', description: '专业制造精密零部件', joinTime: '2023-03-20', expireTime: '2024-03-19' }
      ]
    },
    expandedFloors: {}
  },

  onLoad(options) {
    // 可以从options中获取楼宇ID等参数
    console.log('楼宇ID:', options.id);
  },

  onThumbnailTap(e) {
    const index = e.currentTarget.dataset.index;
    this.setData({
      currentImageIndex: index
    });
  },

  toggleFloor(e) {
    const floorNumber = e.currentTarget.dataset.floor;
    const { expandedFloors } = this.data;
    
    // 切换楼层详情的展开状态
    expandedFloors[floorNumber] = !expandedFloors[floorNumber];
    
    this.setData({
      expandedFloors
    });
  }
});